%% process_showmesh
function process_showmesh(mesh, varargin)
node = mesh.node;
elem = mesh.elem;
edge = mesh.edge;
Np = mesh.Np;
Ne = mesh.Ne;
Ned = mesh.Ned;
Nb = mesh.Nb;
figure;
% mesh
h = patch("Faces", elem(:,1:3), "Vertices", node(1:Np,:));
set(h, "facecolor", "w", "edgecolor", "k");
axis("tight", "equal");
hold on;
% elem
center = zeros(Ne,2);
for i = 1:Ne
    V = node(elem(i,:),:);
    center(i,:) = mean(V);
end
text(center(:,1), center(:,2), int2str((1:Ne)'), "FontSize", 10, "FontWeight", "bold", "Color", "r", "HorizontalAlignment", "right");
% node
shift = 0.001;
range = (1:Np)';
plot(node(range,1), node(range,2), "k.", "MarkerSize", 10);
text(node(range,1)+shift, node(range,2)+shift, int2str(range), "FontSize", 10, "FontWeight", "bold", "Color", "k");
if strcmp(mesh.basis_type, "P1b") || strcmp(mesh.basis_type, "P2") || strcmp(mesh.basis_type, "P3")
    plot(node(Np+1:end,1), node(Np+1:end,2), "k.", "MarkerSize", 10);
    text(node(Np+1:end,1)+shift, node(Np+1:end,2)+shift, int2str((Np+1:Nb)'), "FontSize", 10, "FontWeight", "bold", "Color", "k");
end
% edge
if ~isempty(varargin)
    midpoint = 0.5*[(node(edge(:,1),1) + node(edge(:,2),1)), (node(edge(:,1),2) + node(edge(:,2),2))];
    text(midpoint(:,1), midpoint(:,2), int2str((1:Ned)'), "FontSize", 10, "FontWeight", "bold", "Color", "b", "HorizontalAlignment", "right");
end
hold off
end